﻿using _WebShared.Classes;
using KPIS.DBM;
using KPIS.GERP.ESS.BLL;
using KPIS.GERP.ESS.MODEL;
using System;
using System.Data;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Security.AccessControl;
using System.Text;
using System.Web;
using System.Web.UI;
using Telerik.Web.UI;

namespace KPIS.GERP.ESS.APP.App_UI.Commons
{
    public class Main : System.Web.UI.Page
    {
        private B_SECURITY_Users user = new B_SECURITY_Users();

        public string GetSystemJobsiteName()
        {
            DBManager dbManager = new DBManager(SystemInfo._DataProvider, SystemInfo._ConnectionString);
            ConvertNullable.ConvertNullable cn = new ConvertNullable.ConvertNullable();
            string strResult = "";

            try
            {
                dbManager.Open();

                string strSQL = "select job_site_name from hrm_mp_job_sites j where record_status <> 'D' and job_site_level_seq = 2 and job_site_type_seq = 2";

                DataTable dtb = dbManager.ExecuteDataSet(CommandType.Text, strSQL).Tables[0];

                if (dtb.Rows.Count > 0)
                {
                    strResult = dtb.Rows[0][0].ToString();
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                dbManager.Dispose();
            }

            return strResult;
        }

        public string WebString(string String)
        {
            string strResult = "";

            strResult = String.Replace("&nbsp;", "");

            return strResult;
        }

        public string FinString(string String)
        {
            string strResult = "-";

            if (!string.IsNullOrEmpty(String))
            {
                strResult = String;
            }

            return strResult;
        }

        public FIM_SystemControls.M_FIM_SystemControls GetSystemControls()
        {
            if (Session["SCInfo"] == null)
            {

                FIM_SystemControls.FIM_SystemControls sc = new FIM_SystemControls.FIM_SystemControls();
                try
                {
                    Session["SCInfo"] = sc.GetInfo();
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message + ", " + sc.Url);
                }
            }
            return (FIM_SystemControls.M_FIM_SystemControls) Session["SCInfo"];
        }

        public string GetStatusMessage(int offset, int total)
        {
            if (total <= 0)
                return "ไม่พบข้อมูล";

            return String.Format("ลำดับที่ <b>1</b>-<b>{0}</b> จากทั้งหมด <b>{1}</b>", offset, total);
        }

        public void SetupReport(string strReportName, string strSeq)
        {
            Session["ReportName"] = strReportName;
            Session["ReportSeq"] = strSeq;
        }

        public void InsertEmptyDDLSelect(RadComboBox ddl)
        {
            RadComboBoxItem empty = new RadComboBoxItem("<เลือกรายการ>", "");
            ddl.Items.Insert(0, empty);
        }

        public void InsertEmptyDDLAll(RadComboBox ddl)
        {
            RadComboBoxItem empty = new RadComboBoxItem("<ทั้งหมด>", "");
            ddl.Items.Insert(0, empty);
        }

        public string ErrorEmpty(string strFieldName)
        {
            return "กรุณากรอกข้อมูล [" + strFieldName + "]";
        }
        public string EncodeJsString(string s)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("\"");
            foreach (char c in s)
            {
                switch (c)
                {
                    case '\"':
                        sb.Append("\\\"");
                        break;
                    case '\\':
                        sb.Append("\\\\");
                        break;
                    case '\b':
                        sb.Append("\\b");
                        break;
                    case '\f':
                        sb.Append("\\f");
                        break;
                    case '\n':
                        sb.Append("\\n");
                        break;
                    case '\r':
                        sb.Append("\\r");
                        break;
                    case '\t':
                        sb.Append("\\t");
                        break;
                    default:

                        char[] thaiChars = new char[]{'ก','ข','ฃ','ค','ฅ','ฆ','ง','จ','ฉ','ช','ซ','ฌ','ญ','ฎ','ฏ', 
'ฐ','ฑ','ฒ','ณ','ด','ต','ถ','ท','ธ','น','บ','ป','ผ','ฝ','พ','ฟ',
'ภ','ม','ย','ร','ฤ','ล','ฦ','ว','ศ','ษ','ส','ห','ฬ','อ','ฮ','ฯ',
'ะ','ั','า','ำ','ิ','ี','ึ','ื','ุ','ู','ฺ',' ',' ',' ',' ','฿',
'เ','แ','โ','ใ','ไ','ๅ','ๆ','็','่','้','๊','๋','์','ํ','๎','๏',
'๐','๑','๒','๓','๔','๕','๖','๗','๘','๙','๚','๛'};

                        int i = (int)c;
                        	 	
                        if (!thaiChars.Contains(c) && (i < 32 || i > 127 ))
                        {
                            sb.AppendFormat("\\u{0:X04}", i);
                        }
                        else
                        {
                            sb.Append(c);
                        }
                        break;
                }
            }
            sb.Append("\"");

            return sb.ToString();
        }

        public void MessageAlert(Page p, string strMessage)
        {
            string markup = EncodeJsString(strMessage);

            ScriptManager.RegisterClientScriptBlock(p, p.GetType(), "onclick", "window.alert('" + markup + "');", true);
        }

        public string ConvertNumberToString(Object o)
        {
            string result = "";

            if (o == null)
            {
                result = "0.00";
            }
            else
            {
                switch (o.GetType().ToString())
                {
                    case "System.int":
                    case "System.Int32":
                        result = Convert.ToInt32(o).ToString("#,###.##");
                        break;
                    case "System.double":
                    case "System.Double":
                        result = Convert.ToDouble(o).ToString("#,###.##");
                        break;
                }
            }

            return result;
        }

        public Nullable<int> ConvertNullInt(Object o)
        { 
            Nullable<int> result = (o == null ? null : (o.ToString().Length == 0 ? null : (Nullable<int>) Convert.ToDecimal(o)));
            return result;
        }

        public Nullable<double> ConvertNullDouble(Object o)
        {
            Nullable<double> result = (o == null ? null : (o.ToString().Length == 0 ? null : (Nullable<double>) Convert.ToDouble(o)));
            return result;
        }

        public Nullable<DateTime> ConvertNullDateTime(Object o)
        {
            try
            {
                Nullable<DateTime> result = (o == null ? null : (o.ToString().Length == 0 ? null : (Nullable<DateTime>) Convert.ToDateTime(o)));
                return result;
            }
            catch (Exception exception)
            {
                string newDto = "";
                try
                {
                    string dto = Convert.ToString(o);
                    if (dto.Length == 0) return (DateTime?) null;

                    var dtsp = dto.Split(new[]
                        {
                            '/'
                        }, StringSplitOptions.RemoveEmptyEntries);

                    int year = Convert.ToInt32(dtsp[2]) < 2400 ? (Convert.ToInt32(dtsp[2]) + 543) : Convert.ToInt32(dtsp[2]);
                    int month = Convert.ToInt32(dtsp[1]);
                    int day = Convert.ToInt32(dtsp[0]);
                    return new DateTime(year, month, day);

                }
                catch (Exception exception2)
                {
                    throw new Exception(exception2.Message + "(2)," + newDto);
                }
            }
        }

        public Nullable<TimeSpan> ConvertNullTimeSpan(Object o)
        {
            Nullable<TimeSpan> result = (o == null ? null : (o.ToString().Length == 0 ? null : (Nullable<TimeSpan>) Convert.ToDateTime(o).TimeOfDay));
            return result;
        }

        public string ConvertDBDateTimeToString(Object o, bool bLongDateString)
        {
            string result = null;

            if (bLongDateString)
                result = (o == null ? "" : Convert.ToDateTime(o).ToLongDateString());
            else
                result = (o == null ? "" : Convert.ToDateTime(o).ToShortDateString());

            return result;
        }

        public object ConvertToDB(Object o)
        {
            return (o == null || o.ToString().Trim().Length == 0 ? DBNull.Value : o);
        }

        public M_MessageSend GetLatestMessageStatus(string ref_seq, string ref_type)
        {
            ESS.BLL.B_MessageSend send = new ESS.BLL.B_MessageSend();

            return send.GetLatestMessageStatus(ref_seq, ref_type);
        }

        public string GetNextRefNo(TransectionType type)
        {
            DBManager dbManager = new DBManager(SystemInfo._DataProvider, SystemInfo._ConnectionString);
            ConvertNullable.ConvertNullable cn = new ConvertNullable.ConvertNullable();

            string strTableName = "";
            string strResult = "";
            string strFieldName = "";
            DataTable dtb;

            switch (type)
            {
                case TransectionType.BGM_PROJECT_OPERATION:
                    strTableName = "BGM_PROJECT_OPERATION";
                    strResult = "OP";
                    strFieldName = "bgm_proj_oper_code";
                    break;
                case TransectionType.FIM_MONEY_REQUESTS:
                    strTableName = "FIM_MONEY_REQUESTS";
                    strResult = "RQ";
                    strFieldName = "ref_no";
                    break;
                case TransectionType.FIM_MONEY_REQUESTS_BORROW:
                    strTableName = "FIM_MONEY_REQUESTS";
                    strResult = "BR";
                    strFieldName = "borrow_no";
                    break;
                case TransectionType.FIM_MONEY_RETURNS:
                    strTableName = "FIM_MONEY_RETURNS";
                    strResult = "RT";
                    strFieldName = "ref_no";
                    break;
                case TransectionType.FIM_PAYMENTS:
                    strTableName = "FIM_PAYMENTS";
                    strResult = "PM";
                    strFieldName = "ref_no";
                    break;
                case TransectionType.FIM_PETITIONS:
                    strTableName = "FIM_PETITIONS";
                    strResult = "PT";
                    strFieldName = "ref_no";
                    break;
                case TransectionType.FIM_RECEIVES:
                    strTableName = "FIM_RECEIVES";
                    strResult = "RC";
                    strFieldName = "receipt_no";
                    break;
                case TransectionType.FIM_TRANSFERS:
                    strTableName = "FIM_TRANSFERS";
                    strResult = "TF";
                    strFieldName = "ref_no";
                    break;
            }

            try
            {
                dbManager.Open();
                dbManager.CreateParameters(4);

                dbManager.AddParameters(0, "@delete_status", SystemInfo._DeleteRecordStatus);
                dbManager.AddParameters(1, "@field_name", strFieldName);
                dbManager.AddParameters(2, "@table_name", strTableName);
                dbManager.AddParameters(3, "@result", strResult);

                strResult += "-" + DateTime.Today.ToString("yyyyMM", DateTimeFormatInfo.InvariantInfo) + "-";
                string strSQL = "SELECT MAX(@field_name)" + " FROM @table_name" + " WHERE @field_name LIKE '@result%'";

                dtb = dbManager.ExecuteDataSet(CommandType.Text, strSQL).Tables[0];

                if (dtb.Rows.Count > 0)
                {
                    int nNextRunningNo = int.Parse(StringX.Right(Misc.NullValue(dtb.Rows[0][0], "0000").ToString(), 4)) + 1;
                    strResult += nNextRunningNo.ToString("0000");
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                dbManager.Dispose();
            }

            return strResult;
        }

        //public int GetBgmMonth(string strBgmSourceSeq, Nullable<DateTime> dt)
        //{
        //    int nBgmMonth;
        //    int nMonthStart;
        //    int nCurrentMonth;

        //    IBLL_BGM_MAS_Source source = new B_BGM_MAS_Source();
        //    M_BGM_MAS_Source info = source.GetInfo(strBgmSourceSeq);
        //    nMonthStart = info.month_start.Value;

        //    if (dt == null)
        //    {
        //        dt = DateTime.Today;
        //    }

        //    nCurrentMonth = dt.Value.Month;
        //    nBgmMonth = (nMonthStart <= nCurrentMonth ? nCurrentMonth - nMonthStart + 1 : nCurrentMonth + 13 - nMonthStart);

        //    return nBgmMonth;
        //}

        public void UpdateTabStrip(RadTabStrip tab, int nSelectIndex, string strMode)
        {
            if (strMode == "AddNew")
            {
                for (int i = 0; i < tab.Tabs.Count; i++)
                {
                    tab.Tabs[i].Enabled = i <= nSelectIndex;
                }
            }
            else
            {
                for (int i = 0; i < tab.Tabs.Count; i++)
                {
                    tab.Tabs[i].Enabled = true;
                }
            }
        }

        public void FindTreeValue(RadTreeView treeView, string strValue)
        {
            RadTreeNodeCollection nodes = treeView.Nodes;

            foreach (RadTreeNode tn in nodes)
            {
                if (strValue.Length > 0)
                {
                    if (tn.Value == strValue)
                    {
                        tn.Selected = true;

                        if (tn.ParentNode != null)
                            tn.ParentNode.Expanded = true;

                        return;
                    }
                    FindRecursive(tn, strValue);
                }
            }
        }

        //public void FindTreeValueBgPlan(RadTreeView treeView, string strValue, string strCatagory
        //    , string strBgSourceSeq, string strBgYear, string strBgMonth)
        //{
        //    RadTreeNodeCollection nodes = treeView.Nodes;

        //    foreach (RadTreeNode tn in nodes)
        //    {
        //        if (strValue.Length > 0)
        //        {
        //            if (tn.Value == strValue && tn.Category == strCatagory)
        //            {
        //                tn.Selected = true;
        //                tn.ParentNode.Expanded = true;
        //                return;
        //            }

        //            if (tn.ExpandMode == TreeNodeExpandMode.ServerSideCallBack && tn.Nodes.Count == 0)
        //            {
        //                PopulatePlanNodeOnDemand(tn, TreeNodeExpandMode.ServerSideCallBack
        //                    , strBgSourceSeq, strBgYear, strBgMonth);

        //                tn.Toggle();
        //            }

        //            FindRecursiveBgPlan(tn, strValue, strCatagory
        //                , strBgSourceSeq, strBgYear, strBgMonth);
        //        }
        //    }
        //}

        protected void FindRecursive(RadTreeNode treeNode, string strValue)
        {
            foreach (RadTreeNode tn in treeNode.Nodes)
            {
                if (tn.Value == strValue)
                {
                    tn.Selected = true;

                    if (tn.ParentNode != null)
                        tn.ParentNode.Expanded = true;

                    return;
                }
                FindRecursive(tn, strValue);
            }
        }

        //public void NextFocus(Page p, Control ctrl)
        //{
        //    NextFocus(p, ctrl, 500);
        //}

        //public void NextFocus(Page p, Control ctrl, int nScrollVertical)
        //{
        //    if (ctrl == null)
        //        return;

        //    ClientScript.RegisterStartupScript(p.GetType(), "FocusScript"
        //        , "<script language='javascript'>\n"
        //        + "document.getElementById('" + ctrl.ClientID + "').focus();\n"
        //        + "window.scrollBy(0, " + nScrollVertical.ToString() + ");\n"
        //        + "</script>\n"
        //        );
        //}

        //protected void FindRecursiveBgPlan(RadTreeNode treeNode, string strValue, string strCatagory
        //    , string strBgSourceSeq, string strBgYear, string strBgMonth)
        //{
        //    foreach (RadTreeNode tn in treeNode.Nodes)
        //    {
        //        if (tn.Value == strValue && tn.Category == strCatagory)
        //        {
        //            tn.Selected = true;
        //            tn.ParentNode.Expanded = true;
        //            return;
        //        }

        //        if (tn.ExpandMode == TreeNodeExpandMode.ServerSideCallBack && tn.Nodes.Count == 0)
        //        {
        //            PopulatePlanNodeOnDemand(tn, TreeNodeExpandMode.ServerSideCallBack
        //                , strBgSourceSeq, strBgYear, strBgMonth);

        //            tn.
        //            tn.Toggle();
        //        }
        //        FindRecursiveBgPlan(tn, strValue, strCatagory, strBgSourceSeq, strBgYear, strBgMonth);
        //    }
        //}

        //==========================================================================================

        private bool IsAValidNumber(string strNumberText)
        {
            // There can be only one point and the others must be 0-9
            int i;
            int nPointCount = 0;
            string strChar;
            bool bOK = true;

            for (i = 0; i < strNumberText.Length; i++)
            {
                strChar = strNumberText.Substring(i, 1);

                if (strChar == ".")
                    nPointCount++;

                if (nPointCount > 1 || strChar != "." && (int.Parse(strChar) < 0 || int.Parse(strChar) > 9))
                {
                    bOK = false;
                    break;
                }
            }

            return bOK;
        }

        private string EachNumberPositionThaiText(string strReverseNumberText, int nMaxPosition, int nCurrentPosition, string[] astrPositionName,
                                                  string[] astrDigitName)
        {
            int nDigit;
            string strDigitName;
            int nPosition;
            string strPositionName;
            int nPreviousDigit = 0;

            nDigit = int.Parse(strReverseNumberText.Substring(nCurrentPosition, 1));

            if (nCurrentPosition < nMaxPosition)
                nPreviousDigit = int.Parse(strReverseNumberText.Substring(nCurrentPosition + 1, 1));
            // notice: lngPosition = (lngCurrentPosition - 1) Mod 6 + 1
            nPosition = (nCurrentPosition - 1)%6 + 1;

            if (nDigit == 0 && nMaxPosition > 0 || nDigit == 1 && nPosition == 1)
                strDigitName = "";
            else if (nDigit == 1 && (nPosition == 0 || nPosition == 6) && nMaxPosition > nCurrentPosition && nPreviousDigit > 0)
                strDigitName = "เอ็ด";
            else if (nDigit == 2 && nPosition == 1)
                strDigitName = "ยี่";
            else
                strDigitName = astrDigitName[nDigit];

            if (nDigit == 0 && nPosition != 6)
                strPositionName = "";
            else
                strPositionName = astrPositionName[nPosition];

            return strDigitName + strPositionName;
        }

        public string MoneyTextThai(double dblNumber)
        {
            return MoneyTextThai(dblNumber.ToString(), "บาท", "สตางค์");
        }

        public string MoneyTextThai(decimal dblNumber)
        {
            return MoneyTextThai(dblNumber.ToString(), "บาท", "สตางค์");
        }

        public string MoneyTextThai(string strNumberText)
        {
            return MoneyTextThai(strNumberText, "บาท", "สตางค์");
        }

        public string MoneyTextThai(string strNumberText, string strCurrencyMain, string strCurrencyPercent)
        {
            string strResult = "";
            string[] astrPositionName =
                {
                    "", "สิบ", "ร้อย", "พัน", "หมื่น", "แสน", "ล้าน"
                };
            string[] astrDigitName =
                {
                    "ศูนย์", "หนึ่ง", "สอง", "สาม", "สี่", "ห้า", "หก", "เจ็ด", "แปด", "เก้า"
                };
            string strReverseBaht;
            string strReverseSatang;
            int nPointPosition;
            int nMaxPosition;
            int nCurrentPosition;

            // simplify the number
            strNumberText = strNumberText.Trim().Replace(",", "");

            while (strNumberText.Length > 1 && StringX.Left(strNumberText, 1) == "0" && StringX.Left(strNumberText, 2) != "0.")
                strNumberText = strNumberText.Substring(1);

            // check number validation
            if (!IsAValidNumber(strNumberText))
                throw new Exception(strNumberText + " ไม่ใช่จำนวนที่ถูกต้อง");

            // separate baht and satang
            nPointPosition = strNumberText.IndexOf(".");

            if (nPointPosition >= 0)
            {
                strReverseBaht = StringX.StrReverse(strNumberText.Substring(0, nPointPosition));
                strReverseSatang = StringX.StrReverse(StringX.Right(double.Parse(strNumberText.Substring(nPointPosition)).ToString(".00"), 2));
            }
            else
            {
                strReverseBaht = StringX.StrReverse(strNumberText);
                strReverseSatang = "00";
            }

            // begin process baht
            nMaxPosition = strReverseBaht.Length - 1;

            for (nCurrentPosition = nMaxPosition; nCurrentPosition >= 0; nCurrentPosition--)
            {
                strResult += EachNumberPositionThaiText(strReverseBaht, nMaxPosition, nCurrentPosition, astrPositionName, astrDigitName);
            }

            if (strResult.Length > 0)
                strResult += strCurrencyMain;
            // end process baht

            // begin process satang
            if (strResult.Length > 0 && strReverseSatang == "00")
            {
                strResult += "ถ้วน";
            }
            else
            {
                if (strResult == "ศูนย์ " + strCurrencyMain)
                    strResult = "";

                nMaxPosition = strReverseSatang.Length - 1;

                for (nCurrentPosition = nMaxPosition; nCurrentPosition >= 0; nCurrentPosition--)
                    strResult += EachNumberPositionThaiText(strReverseSatang, nMaxPosition, nCurrentPosition, astrPositionName, astrDigitName);

                if (strResult.Length > 0)
                    strResult += strCurrencyPercent;
            }
            // end process satang

            return strResult;
        }

        public void FolderACL(String accountName, String folderPath)
        {
            FileSystemRights Rights;

            //What rights are we setting?
            Rights = FileSystemRights.FullControl;
            bool modified;
            InheritanceFlags none = new InheritanceFlags();
            none = InheritanceFlags.None;

            //set on dir itself
            FileSystemAccessRule accessRule = new FileSystemAccessRule(accountName, Rights, none, PropagationFlags.NoPropagateInherit, AccessControlType.Allow);
            DirectoryInfo dInfo = new DirectoryInfo(folderPath);
            DirectorySecurity dSecurity = dInfo.GetAccessControl();
            dSecurity.ModifyAccessRule(AccessControlModification.Set, accessRule, out modified);

            //Always allow objects to inherit on a directory 
            InheritanceFlags iFlags = new InheritanceFlags();
            iFlags = InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit;

            //Add Access rule for the inheritance
            FileSystemAccessRule accessRule2 = new FileSystemAccessRule(accountName, Rights, iFlags, PropagationFlags.InheritOnly, AccessControlType.Allow);
            dSecurity.ModifyAccessRule(AccessControlModification.Add, accessRule2, out modified);

            dInfo.SetAccessControl(dSecurity);
        }

        public string Get(string paramIndex)
        {
            return HttpContext.Current.Request[paramIndex];
        }

        public bool IsSameValueGet(string paramIndex, object valueToCheck)
        {
            string paramValue = HttpContext.Current.Request[paramIndex];
            string compareValue = Convert.ToString(valueToCheck);
            return (paramValue ?? string.Empty).ToLower().Trim() == (compareValue ?? string.Empty).ToLower().Trim();
        }

        public bool CheckDuplicateMessage(string strSendSeq)
        {
            DBManager dbManager = new DBManager(SystemInfo._DataProvider, SystemInfo._ConnectionString);

            try
            {
                dbManager.Open();
                dbManager.CreateParameters(1);
                dbManager.AddParameters(0, "@send_seq", strSendSeq);

                string strSQL = "select count(*) as row_count from message_send where record_status <> 'D' and from_send_seq = @send_seq";

                DataTable dtb = dbManager.ExecuteDataSet(CommandType.Text, strSQL).Tables[0];

                if (dtb.Rows.Count > 0)
                {
                    return Convert.ToInt32(dtb.Rows[0][0].ToString()) > 0;
                }
                else
                {
                    return false;
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                dbManager.Dispose();
            }
        }

        public bool CheckDuplicateMessage2(string strSendSeq)
        {
            DBManager dbManager = new DBManager(SystemInfo._DataProvider, SystemInfo._ConnectionString);

            try
            {
                dbManager.Open();
                dbManager.CreateParameters(1);
                dbManager.AddParameters(0, "@send_seq", strSendSeq);

                string strSQL = "select message_status from message_send where record_status <> 'D' and send_seq = @send_seq";

                DataTable dtb = dbManager.ExecuteDataSet(CommandType.Text, strSQL).Tables[0];

                if (dtb.Rows.Count > 0)
                {
                    return dtb.Rows[0][0].ToString() == "2" || dtb.Rows[0][0].ToString() == "3";
                }
                else
                {
                    return false;
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                dbManager.Dispose();
            }
        }
    }

    public class UserInfo
    {
        public string strUserID;
        public string strUserName;
        public string strEmpSeq;

        public UserInfo()
        {

        }

        public string UserID
        {
            get { return strUserID; }
            set { strUserID = value; }
        }

        public string UserName
        {
            get { return strUserName; }
            set { strUserName = value; }
        }

        public string EmpSeq
        {
            get { return strEmpSeq; }
            set { strEmpSeq = value; }
        }
    }

    public enum MDataType
    {
        String,
        DateTime,
        Int,
        Double
    }

    public enum TransectionType
    {
        BGM_PROJECT_OPERATION,
        FIM_MONEY_REQUESTS,
        FIM_MONEY_REQUESTS_BORROW,
        FIM_MONEY_RETURNS,
        FIM_PAYMENTS,
        FIM_PETITIONS,
        FIM_RECEIVES,
        FIM_TRANSFERS
    }
}